from functools import reduce

list1=[1,2,3,4,5]
li1=[i**2 for i in list1]

result=map(lambda a:a**2,list1)
print(list(result))

#偶数变成原来的两倍，奇数不变
result2=map(lambda a:a*a if a%2==0 else a,list1)
print(list(result2))
li2=[i ** 2 if i % 2==0 else i for i in list1]
print(li2)
list2=[1,2,3,4,5]
r3=reduce(lambda a,b:a+b,list2)

print(r3)

list3=[1,2,3,4,5,6,7,8,9,10]
li3=[i  for i in list3 if i % 2==0]
r4=filter(lambda a:a if a%2==0 else '' ,list3)
print(list(r4))
print(li3)
